package run.bottle.gof23.prototype;

import java.util.Date;

public class DeepImage implements Cloneable {

    private String name;
    private Date createTime;

    public DeepImage() {
    }

    public DeepImage(String name, Date createTime) {
        this.name = name;
        this.createTime = createTime;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        Object clone = super.clone();
        DeepImage image = (DeepImage) clone;
        image.createTime = (Date) image.createTime.clone();//将这个对象的属性也进行克隆
        return clone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Image{" +
                "name='" + name + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
